# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=python-libarchive-c
pkgver=4.0
pkgrel=3
pkgdesc='Python interface to libarchive'
url='https://github.com/Changaco/python-libarchive-c'
arch=('any')
license=('CC0')
depends=('python' 'libarchive')
makedepends=('python-setuptools')
checkdepends=('python-pytest')
source=(https://github.com/Changaco/python-libarchive-c/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz
        drop-python-mock-dependency.patch::https://github.com/Changaco/python-libarchive-c/commit/13b904e2b046db25a42cd63557d259b3d3998323.patch)
sha512sums=('1544713802789859ffa9a0d8f4e490f720bbd4d589aae8899d0d1fb6780f2cde0db96f3023c1c32eacea07ea325ac180797aebdb0e8e37093af53807f2e5c812'
            '03982be41ca25010a6964c11480e20d4ca38f04bd95945ec6aca0e70351d89a40b551df79a014849c36870cffa112656798cfec46cb60b7b21ea33cabf63bc60')
b2sums=('87f8cfb0adf080b11df85d065fbcc38bf5682592882b3a8a8077e5cfb590cc10a05b98c98a2be41570aa59d06899b2e47815183e563007b1077717cdaa79a21c'
        'f47727a0a9325f64a35533977a3b4551fef5759e3b34c3a4319dfbd44d76cf620a0dd75fe67550d6e97c6c50c791964cf9c781ccb431023ddb26fc44f932b816')

prepare() {
  sed '/os.umask(2)/d' -i ${pkgbase}-${pkgver}/setup.py
  cd ${pkgbase}-${pkgver}
  patch -Np1 -i ${srcdir}/drop-python-mock-dependency.patch
}

check() {
  cd ${pkgbase}-${pkgver}
  LC_CTYPE=en_US.UTF-8 py.test
}

build() {
  cd ${pkgbase}-${pkgver}
  python setup.py build
}

package() {
  cd ${pkgbase}-${pkgver}
  python setup.py install -O1 --root="${pkgdir}" --skip-build
  install -Dm 644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE.md -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
